package nio.buffer;

import java.nio.ByteBuffer;

/**
 * 往buffer里面存入什么类型的数据，取出的时候也要对应其类型
 */
public class ByteBufferPutGet {
    public static void main(String[] args) {
        ByteBuffer byteBuffer = ByteBuffer.allocate(50);
        byteBuffer.putChar('刘');
        byteBuffer.putInt(123);

        byteBuffer.flip();
        System.out.println(byteBuffer.getChar());
        System.out.println(byteBuffer.getInt());
    }
}
